#pragma once
#ifndef CLIENT_H
#define CLIENT_H

#include <string>
#include <memory>
#include <thread>
#include <mutex>
#include <functional>
#include <iostream>
#include <WinSock2.h>
#include <WS2tcpip.h>

#pragma comment(lib, "ws2_32.lib")

class Client {
public:
    explicit Client();
    ~Client();

    bool connect(const std::string& address, uint16_t port);
    void disconnect();
    bool sendMessage(const std::string& message);
    void setMessageCallback(std::function<void(const std::string&, const std::string&)> callback);

private:
    SOCKET client_socket;
    bool connected;
    std::unique_ptr<std::thread> receive_thread;
    std::mutex mutex;
    std::function<void(const std::string&, const std::string&)> message_callback;

    void receiveMessages();
    std::string getCurrentTime() const;
    void initializeWinsock();
};

#endif // CLIENT_H 